package com.yy.weixinpay.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.experimental.Accessors;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: lee
 * @Date: 2022/1/18 10:53
 */
@Data
@AllArgsConstructor
@Accessors(chain = true)
public class R {
    private Integer code; //响应码
    private String message;
    private Map<String,Object> data=new HashMap<>();

    public static R ok(){
       return new R(0,"success",null);
    }

    public static R error(){
        return new R(-1,"fail",null);
    }

    public R data(String key,Object value){
        data=new HashMap<>();
        this.data.put(key,value);
        return this;
    }
}
